package com.soundShape.utils
{
	import mx.events.EffectEvent;
	
	import spark.components.Image;
	import spark.effects.Fade;
	import spark.effects.Move;

	public class GreenArrow extends Image 
	{
		
		[Bindable]
		[Embed(source="assets/arrow.png")]
		private var arrow:Class;
		
		public function GreenArrow()
		{
			super();
			this.source = arrow;
			this.height = 50;
			this.alpha = 0.0;
		}
		
		public function doGreenArrow():void
		{
			var fade:Fade = new Fade();
			fade.target = this;
			fade.alphaFrom = 0;
			fade.alphaTo = 50;
			fade.duration = 2000;
			fade.addEventListener(EffectEvent.EFFECT_END,doArrowEffectEnd);
			
			var move:Move = new Move();
			move.target = this;
			move.xFrom = this.x - 200;
			move.xTo = this.x;
			move.duration = 1000;
			
			fade.play();
			move.play();
		}
		
		public function doArrowEffectEnd(effectEvent:EffectEvent):void
		{
			var fade:Fade = new Fade();
			fade.target = this;
			fade.alphaFrom = 50;
			fade.alphaTo = 0;
			fade.duration = 100;
			fade.play();
		}
	}
}